<template>
  <el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm">
    <el-divider content-position="left">工规</el-divider>
    <div class="industrial" style="margin-top: 0.2rem;">
      <el-scrollbar>
        <div class="industrialBox formlist" style="height: 5rem;">
          <!-- <el-form :model="industrialForm" ref="industrialForm" label-width="200px" class="formlist"> -->
          <!-- </el-form> -->
          <mail-table :tableData="this.tableRegulations" :tableStyle="{ width:'100%' }"></mail-table>
        </div>
      </el-scrollbar>
    </div>
    <el-divider content-position="left">其他参数</el-divider>
    <!-- <div style="margin-top: 0.2rem;text-align: center;">
      <el-radio-group v-model="radio" size="small">
        <el-radio label="1" border size="medium">单工序</el-radio>
        <el-radio label="2" border size="medium">全工序</el-radio>
      </el-radio-group>
    </div> -->
    <div class="otherParams">
      <el-form :model="otherForm" ref="otherForm" label-width="200px" class="otherForm formlist">
        <!-- <el-form-item
          label="工序号"
          prop="num"
          v-show="this.radio === '1'"
        >
          <el-select v-model="otherForm.num" placeholder="请选择工序号">
            <el-option label="工序1" value="1"></el-option>
            <el-option label="工序2" value="2"></el-option>
            <el-option label="工序3" value="3"></el-option>
            <el-option label="工序4" value="4"></el-option>
            <el-option label="工序5" value="5"></el-option>
          </el-select>
        </el-form-item> -->
        <el-steps v-model="otherForm.num" :active="this.active" finish-status="success" style="margin: 0.5rem auto;">
          <el-step title="工序 1"></el-step>
          <el-step title="工序 2"></el-step>
          <el-step title="工序 3"></el-step>
        </el-steps>
        <el-form-item
          v-show="this.onlyOneStep"
          label="数据量"
          prop="dataVolume"
          :rules="[
            { required: true, message: '数据量不能为空'}
          ]"
        >
          <el-input type="passRate" v-model="otherForm.dataVolume" oninput = "value=value.replace(/[^0-9.-]/g,'')" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item
          label="初始质检合格率控制"
          prop="passRate"
          :rules="[
            { required: true, message: '合格率控制不能为空'}
          ]"
        >
          <el-input type="passRate" v-model="otherForm.passRate" oninput = "value=value.replace(/[^0-9.-]/g,'')" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item
          label="是否存在参数交互"
          prop="interactive"
        >
          <el-radio-group v-model="otherForm.interactive">
            <el-radio label="是"></el-radio>
            <el-radio label="否"></el-radio>
          </el-radio-group>
        </el-form-item>
        <div class="procedure" v-show="this.otherForm.interactive === '是'">
          <div class="procedure4_5">
            <el-form-item
              label="交互权重"
              prop="weight"
              :rules="[
                { required: true, message: '交互权重不能为空'}
              ]"
            >
              <el-input type="weight" v-model="otherForm.weight" oninput = "value=value.replace(/[^0-9.-]/g,'')"  autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item
              label="交互影响因子"
              prop="factor"
              :rules="[
                { required: true, message: '交互影响因子不能为空'}
              ]"
            >
              <el-input type="factor" v-model="otherForm.factor" autocomplete="off"></el-input>
            </el-form-item>
            <!-- <el-form-item
              label="误差传递系数"
              prop="errnum"
              :rules="[
                { required: true, message: '误差传递系数不能为空'}
              ]"
            >
              <el-input type="errnum" v-model="otherForm.errnum" oninput = "value=value.replace(/[^0-9.-]/g,'')" autocomplete="off"></el-input>
            </el-form-item> -->
            <el-form-item
                v-for="(domain, index) in this.otherForm.interSetting"
                :label="'交互设置 ' + (index + 1)"
                :key="index * 3"
                :rules="{
                  required: true, message: '交互系数不能为空', trigger: 'blur'
                }"
              >
                <el-select v-model="domain.select1" placeholder="请选择">
                  <el-option
                    v-for="item of setList"
                    :label="item.label"
                    :key="Math.random() * 5"
                    :value="item.label">
                  </el-option>
                </el-select>
                -
                 <el-select v-model="domain.select2" placeholder="请选择">
                  <el-option
                    v-for="item of setList"
                    :label="item.label"
                    :key="Math.random() * 15"
                    :value="item.label">
                  </el-option>
                </el-select>
                <el-input v-model="domain.value" class="setnum" oninput = "value=value.replace(/[^0-9].-/g,'')"></el-input>&nbsp;
                <el-button @click.prevent="removeDomain(domain)">删除</el-button>
              </el-form-item>
          </div>
        </div>
      </el-form>
    </div>
    <span v-show="this.otherForm.interactive === '是'" style="font-size: 0.12rem; color: #919191;display: block;text-align: center;">（注：每项交互设置中的值相加的和必须等于1）</span>
    <!-- <el-collapse v-model="activeNames" @change="handleChange">
      <el-collapse-item title="工规" name="1">

      </el-collapse-item>
      <el-collapse-item title="其他参数" name="2">

      </el-collapse-item>
    </el-collapse> -->
    <el-form-item class="submitBtn">
      <el-button @click="addDomain" type="warning" v-show="this.otherForm.interactive === '是'">新增交互设置</el-button>
      
      <div style="margin:0.1rem 0">
        <el-button v-show="showprebtn" @click="pre">上一步</el-button>
        <el-button @click="next">下一步</el-button>
      </div>
      
      <el-button v-show="lastStep" style="margin-top: 0;" type="primary" @click="submitForm">立即创建</el-button>
      <!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
    </el-form-item>
  </el-form>
</template>

<script>
import mailTable from './ver-table'
export default {
  name: 'formBuild',
  props: {
    tableData: {
      type: Object,
      default: () => {}
    }
  },
  components: {
    mailTable
  },
  data () {
    return {
      active: 0,
      lastStep: false,
      onlyOneStep: true,
      showprebtn: false,
      tableRegulations: {
        '工序1': {
          pp: [
            {Label: '搅拌速度', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: 'x_注射压力', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: 'x_保压时间', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: 'x_模板预热温度', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: '浆料缸温度', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: 'x_合模压力', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: 'x_烧结温度', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: 'x_保温时间', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: 'x_升温速度', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: 'x_降温速度', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: '高温强化时间', LB: '', RB: '', index1: '1', suiwo: '工艺参数'},
            {Label: '室温强化时间', LB: '', RB: '', index1: '1', suiwo: '工艺参数'}
          ],
          sqp: [
            {Label: '型芯强度', LB: '', RB: '', index1: '1', suiwo: '中间检'},
            {Label: '型芯收缩率', LB: '', RB: '', index1: '1', suiwo: '中间检'},
            {Label: '型芯尺寸偏差', LB: '', RB: '', index1: '1', suiwo: '中间检'}
          ]
        },
        '工序2': {
          pp: [
            {Label: '收缩率', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: '软化点', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: '变形率', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: '表面强度', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: '灰分', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: 'l_粘度', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: '化学质量', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: 'l_注射压力', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: 'l_保压时间', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: 'l_模板预热温度', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: '蜡膏温度', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: 'l_环境温度', LB: '', RB: '', index1: '2', suiwo: '工艺参数'},
            {Label: 'l_合模压力', LB: '', RB: '', index1: '2', suiwo: '工艺参数'}
          ],
          sqp: [
            {Label: '蜡模强度', LB: '', RB: '', index1: '2', suiwo: '中间检'},
            {Label: '蜡模尺寸偏差', LB: '', RB: '', index1: '2', suiwo: '中间检'},
            {Label: '蜡模是否完整', LB: '', RB: '', index1: '2', suiwo: '中间检'}
          ]
        },
        '工序3': {
          pp: [
            {Label: '热膨胀性', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: '化学成分', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: '粒度', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: 't_粘度', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: 't_环境温度', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: '模壳湿度/环境湿度', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: '模壳厚度', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: '升压速度', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: '脱蜡压力', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: '脱蜡温度', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: 't_焙烧温度', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: 't_保温时间', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: 't_升温速度', LB: '', RB: '', index1: '3', suiwo: '工艺参数'},
            {Label: 't_降温速度', LB: '', RB: '', index1: '3', suiwo: '工艺参数'}
          ],
          sqp: [
            {Label: '模壳收缩率', LB: '', RB: '', index1: '3', suiwo: '中间检'},
            {Label: '粘砂缺陷', LB: '', RB: '', index1: '3', suiwo: '中间检'},
            {Label: '夹杂缺陷', LB: '', RB: '', index1: '3', suiwo: '中间检'},
            {Label: '模壳强度', LB: '', RB: '', index1: '3', suiwo: '中间检'},
            {Label: '模壳质量缺陷', LB: '', RB: '', index1: '3', suiwo: '中间检'},
            {Label: '模壳裂纹缺陷', LB: '', RB: '', index1: '3', suiwo: '中间检'},
            {Label: '蜡料残留', LB: '', RB: '', index1: '3', suiwo: '中间检'},
            {Label: '模壳内表面缺陷', LB: '', RB: '', index1: '3', suiwo: '中间检'},
            {Label: '内表面杂质', LB: '', RB: '', index1: '3', suiwo: '中间检'}
          ]
        },
        '工序4': {
          pp: [
            {Label: '合金成分', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '耐火材料成分', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '蜡料成分', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '精炼温度', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '精炼时间', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: 'r_真空度', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '浇注温度', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '过滤器', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '浇注速度', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '拉晶速度', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '温度梯度', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '模组加热温度', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '模组升温速度', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '金属液静置时间', LB: '', RB: '', index1: '4', suiwo: '工艺参数'},
            {Label: '冷却时间', LB: '', RB: '', index1: '4', suiwo: '工艺参数'}
          ],
          sqp: []
        },
        '工序5': {
          pp: [
            {Label: '手工清壳/水力清壳', LB: '', RB: '', index1: '5', suiwo: '工艺参数'},
            {Label: '线切割/砂轮切割', LB: '', RB: '', index1: '5', suiwo: '工艺参数'},
            {Label: '脱芯液成分', LB: '', RB: '', index1: '5', suiwo: '工艺参数'},
            {Label: '脱芯温度', LB: '', RB: '', index1: '5', suiwo: '工艺参数'},
            {Label: '脱芯压力', LB: '', RB: '', index1: '5', suiwo: '工艺参数'},
            {Label: '脱芯时间', LB: '', RB: '', index1: '5', suiwo: '工艺参数'},
            {Label: '打磨时长', LB: '', RB: '', index1: '5', suiwo: '工艺参数'}
          ],
          sqp: []
        },
        '工序终检': {
          pp: [
            {Label: '型芯裂纹断裂', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '有无型芯缺陷', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '型芯力学性能', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '型芯尺寸', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '叶片型面尺寸', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '小角度晶界偏差', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '叶片尺寸精度', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '有无叶片夹杂缺陷', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '表面粗糙度', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '有无表面再结晶', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '是否有残芯', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '有无叶片裂纹断裂', LB: '', RB: '', index1: '6', suiwo: '终检参数'},
            {Label: '有无叶片表面缺陷', LB: '', RB: '', index1: '6', suiwo: '终检参数'}
          ],
          sqp: []
        }
      },
      setList: [],
      setList1: [
        {label: '搅拌速度', value: '0'},
        {label: 'x_注射压力', id: '1'},
        {label: 'x_保压时间', id: '2'},
        {label: 'x_模板预热温度', id: '3'},
        {label: '浆料缸温度', id: '4'},
        {label: 'x_合模压力', id: '5'},
        {label: 'x_烧结温度', id: '6'},
        {label: 'x_保温时间', id: '7'},
        {label: 'x_升温速度', id: '8'},
        {label: 'x_降温速度', id: '9'},
        {label: '高温强化时间', id: '10'},
        {label: '室温强化时间', id: '11'}
      ],
      setList2: [
        {label: '收缩率', id: '0'},
        {label: '软化点', id: '1'},
        {label: '变形率', id: '2'},
        {label: '表面强度', id: '3'},
        {label: '灰分', id: '4'},
        {label: 'l_粘度', id: '5'},
        {label: '化学质量', id: '6'},
        {label: 'l_注射压力', id: '7'},
        {label: 'l_保压时间', id: '8'},
        {label: 'l_模板预热温度', id: '9'},
        {label: '蜡膏温度', id: '10'},
        {label: 'l_环境温度', id: '11'},
        {label: 'l_合模压力', id: '12'}
      ],
      setList3: [
        {label: '热膨胀性', id: '0'},
        {label: '化学成分', id: '1'},
        {label: '粒度', id: '2'},
        {label: 't_粘度', id: '3'},
        {label: 't_环境温度', id: '4'},
        {label: '模壳湿度/环境湿度', id: '5'},
        {label: '模壳厚度', id: '6'},
        {label: '升压速度', id: '7'},
        {label: '脱蜡压力', id: '8'},
        {label: '脱蜡温度', id: '9'},
        {label: 't_焙烧温度', id: '10'},
        {label: 't_保温时间', id: '11'},
        {label: 't_升温速度', id: '12'},
        {label: 't_降温速度', id: '13'}
      ],
      ruleForm: {},
      industrialForm: [
        {label: '搅拌速度'},
        {label: 'x_注射压力'},
        {label: 'x_保压时间'},
        {label: 'x_模板预热温度'},
        {label: '浆料缸温度'},
        {label: 'x_合模压力'},
        {label: 'x_烧结温度'},
        {label: 'x_保温时间'},
        {label: 'x_升温速度'},
        {label: 'x_降温速度'},
        {label: '高温强化时间'},
        {label: '室温强化时间'},
        {label: '收缩率'},
        {label: '软化点'},
        {label: '变形率'},
        {label: '表面强度'},
        {label: '灰分'},
        {label: 'l_粘度'},
        {label: '化学质量'},
        {label: 'l_注射压力'},
        {label: 'l_保压时间'},
        {label: 'l_模板预热温度'},
        {label: '蜡膏温度'},
        {label: 'l_环境温度'},
        {label: 'l_合模压力'},
        {label: '热膨胀性'},
        {label: '化学成分'},
        {label: '粒度'},
        {label: 't_粘度'},
        {label: 't_环境温度'},
        {label: '模壳湿度/环境湿度'},
        {label: '模壳厚度'},
        {label: '升压速度'},
        {label: '脱蜡压力'},
        {label: '脱蜡温度'},
        {label: 't_焙烧温度'},
        {label: 't_保温时间'},
        {label: 't_升温速度'},
        {label: 't_降温速度'},
        {label: '合金成分'},
        {label: '耐火材料成分'},
        {label: '蜡料成分'},
        {label: '精炼温度'},
        {label: '精炼时间'},
        {label: 'r_真空度'},
        {label: '浇注温度'},
        {label: '过滤器'},
        {label: '浇注速度'},
        {label: '拉晶速度'},
        {label: '温度梯度'},
        {label: '模组加热温度'},
        {label: '模组升温速度'},
        {label: '金属液静置时间'},
        {label: '冷却时间'},
        {label: '手工清壳/水力清壳'},
        {label: '线切割/砂轮切割'},
        {label: '脱芯液成分'},
        {label: '脱芯温度'},
        {label: '脱芯压力'},
        {label: '脱芯时间'},
        {label: '打磨时长'},
        {label: '热处理温度'},
        {label: 'h_升温速度'},
        {label: 'h_降温速度'},
        {label: '气淬压力'},
        {label: 'h_真空度'},
        {label: '型芯强度'},
        {label: '型芯收缩率'},
        {label: '型芯尺寸偏差'},
        {label: '蜡模强度'},
        {label: '蜡模尺寸偏差'},
        {label: '蜡模是否完整'},
        {label: '模壳收缩率'},
        {label: '粘砂缺陷'},
        {label: '夹杂缺陷'},
        {label: '模壳强度'},
        {label: '模壳质量缺陷'},
        {label: '模壳裂纹缺陷'},
        {label: '蜡料残留'},
        {label: '模壳内表面缺陷'},
        {label: '内表面杂质'},
        {label: '型芯裂纹断裂'},
        {label: '有无型芯缺陷'},
        {label: '型芯力学性能'},
        {label: '型芯尺寸'},
        {label: '叶片型面尺寸'},
        {label: '小角度晶界偏差'},
        {label: '叶片尺寸精度'},
        {label: '有无叶片夹杂缺陷'},
        {label: '表面粗糙度'},
        {label: '有无表面再结晶'},
        {label: '是否有残芯'},
        {label: '有无叶片裂纹断裂'},
        {label: '有无叶片表面缺陷'}
      ],
      otherForm: {
        active: 0,
        num: '1',
        dataVolume: '200',
        passRate: '1.5',
        interactive: '是',
        weight: '0.5',
        factor: '10',
        // interactiveNum: '',
        // errnum: '',
        interSetting: [{
          key: Date.now(),
          value: '0',
          select1: '',
          select2: ''
        }]
      },
      workingProcedure1: {},
      workingProcedure2: {},
      workingProcedure3: {},
      orginFrom: {
        active: 0,
        num: '1',
        dataVolume: 200,
        passRate: '1.5',
        interactive: '是',
        weight: '0.5',
        factor: '10',
        // interactiveNum: '',
        errnum: '',
        interSetting: [{
          key: Date.now(),
          value: '0',
          select1: '',
          select2: ''
        }]
      }
      // activeNames: ['1'],
      // radio: '1'
    }
  },
  watch: {
    tableData: function (newVal, oldVal) {
      this.tableRegulations = newVal
    }
  },
  methods: {
    next () {
      var r = this.isThanOne(this.otherForm.interSetting)
      if (r && this.otherForm.interactive == '是') {
        this.$alert('每项交互设置中的值相加的和必须等于1', '提示')
      } else {
        var n = this.active++
        this.onlyOneStep = false
        if (n === 0) {
          this.setList = JSON.parse(JSON.stringify(this.setList2))
          this.workingProcedure1 = JSON.parse(JSON.stringify(this.otherForm))
          this.lastStep = false
          this.otherForm = JSON.parse(JSON.stringify(this.orginFrom))
          
          this.showprebtn = true
        } else if (n === 1) {
          this.setList = JSON.parse(JSON.stringify(this.setList3))
          this.workingProcedure2 = JSON.parse(JSON.stringify(this.otherForm))
          this.lastStep = true
          this.otherForm = JSON.parse(JSON.stringify(this.orginFrom))
          
          this.showprebtn = true
        } else if (n === 2) {
          this.$confirm('您是否已经提交完毕，如果继续将清除之前的记录，重新填写, 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.setList = JSON.parse(JSON.stringify(this.setList1))
            this.active = 0
            this.lastStep = false
            this.onlyOneStep = true
            this.otherForm = JSON.parse(JSON.stringify(this.orginFrom))
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消操作'
            })
          })
          // this.setList = this.setList1
          // this.workingProcedure3 = this.otherForm
          // this.active = 1
        }
      }
    },
    // 上一步
    pre (){
      var n = this.active--
      this.lastStep = false
      if(n == 1){
        this.showprebtn = false //跳转到第一步
        
        this.setList = JSON.parse(JSON.stringify(this.setList1))
        this.active = 0
        this.lastStep = false
        this.onlyOneStep = true
        this.otherForm = JSON.parse(JSON.stringify(this.orginFrom))
      }else if(n == 2){
        this.showprebtn = true // 跳转到第二步
        
        this.setList = JSON.parse(JSON.stringify(this.setList2))
        this.workingProcedure1 = JSON.parse(JSON.stringify(this.otherForm))
        this.lastStep = false
        this.otherForm = JSON.parse(JSON.stringify(this.orginFrom))
      }
    },
    isThanOne (IS) {
      var a = 0
      IS.forEach(item => {
        a += Number(item.value)
      })
      if (a !== 1) {
        return true
      } else {
        return false
      }
    },
    submitForm () {
      var r = this.isThanOne(this.otherForm.interSetting)
      if (r && this.otherForm.interactive == '是') {
        this.$alert('每项交互设置中的值相加的和必须等于1', '提示')
      } else {
        
        // 显示loading保存loading实例
        let loadingInstance = this.$loading({
          lock: true,
          text: 'Loading',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        })
        
        this.workingProcedure3 = JSON.parse(JSON.stringify(this.otherForm))
        this.$api.submitFormTable({
          file: JSON.stringify(this.tableRegulations),
          workingProcedure1: JSON.stringify(this.workingProcedure1),
          workingProcedure2: JSON.stringify(this.workingProcedure2),
          workingProcedure3: JSON.stringify(this.workingProcedure3)
        }).then(res => {
          this.$emit('generateRes', res)
          
          // 消失loading
          loadingInstance.close()
          // 跳转数据生成
          this.$emit('tabIndex', '2')
        }).catch(res => {
          this.$alert(JSON.parse(res)['msg'], '提示')
        })
      }
    },
    change (val) {
      console.log(val)
    },
    // resetForm (formName) {
    //   this.$refs[formName].resetFields()
    // },
    removeDomain (item) {
      var index = this.otherForm.interSetting.indexOf(item)
      if (index !== -1) {
        this.otherForm.interSetting.splice(index, 1)
      }
    },
    addDomain () {
      this.otherForm.interSetting.push({
        key: Date.now(),
        value: '',
        select1: '',
        select2: ''
      })
    }
  },
  mounted () {
    this.setList = this.setList1
  }
}
</script>

<style lang="scss" scoped="scoped">
.el-collapse-item__header {
  font-size: 0.16rem;
  font-weight: 700;
}
.el-form.demo-ruleForm {
  margin-top: 0.15rem;
  .el-collapse {
    border-color: #c5c5c5;
  }
}
.el-form-item {
  margin-top: 0.2rem;
}
.submitBtn {
  text-align: center;
}

</style>
